package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.DtsRegionMapper;
import com.qf.pojo.DtsGoods;
import com.qf.pojo.DtsRegion;
import com.qf.service.DtsRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

@Service
public class DtsRegionServiceImpl implements DtsRegionService {

    @Autowired
    DtsRegionMapper regionMapper;

    @Override
    public IPage<DtsRegion> findPage(Integer page, Integer limit, String name, String code) {
        IPage<DtsRegion> iPage = new Page<>();

        QueryWrapper<DtsRegion> wrapper = new QueryWrapper<>();
        if(!StringUtils.isEmpty(name)){
            wrapper.like("name",name);
        }

        if(!StringUtils.isEmpty(code)){
            wrapper.like("code",code);
        }
        iPage = regionMapper.selectPage(iPage,wrapper);
        return iPage;
    }
}
